package com.xxx.system.service.impl;

import com.github.pagehelper.PageHelper;
import com.xxx.system.domain.Permission;
import com.xxx.system.mapper.PermissionMapper;
import com.xxx.system.query.PermissionQuery;
import com.xxx.system.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionServiceImpl implements IPermissionService {
    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public void addPermission(Permission permission) {
        permissionMapper.addPermission(permission);
    }

    @Override
    public void updatePermission(Permission permission) {
        permissionMapper.updatePermission(permission);

    }

    @Override
    public void deleteById(Long id) {
        permissionMapper.deleteById(id);
    }

    @Override
    public Permission findOne(Long id) {
        return permissionMapper.findOne(id);
    }

    @Override
    public List<Permission> findAllPerm() {
        return permissionMapper.findAllPerm();
    }

    @Override
    public List<Permission> queryPage(PermissionQuery permissionQuery) {
        PageHelper.startPage(permissionQuery.getCurrentPage(), permissionQuery.getPageSize());
        return permissionMapper.queryPage(permissionQuery);

    }

    @Override
    public void deletePermissionByIds(Long[] ids) {
        permissionMapper.deletePermissionByIds(ids);
    }

    @Override
    public Permission selectBySn(String sn) {
        return permissionMapper.selectBySn(sn);
    }
}